import Axios, { type AxiosInstance, type AxiosRequestConfig } from 'axios';


const axios: AxiosInstance = Axios.create({
  baseURL: 'http://localhost:3000',
  timeout: 5000
} as AxiosRequestConfig)

axios.interceptors.request.use(
  (request) => {
    return request;

  },
  (error) => {
    return Promise.reject(error)
  })

axios.interceptors.response.use(
  (response) => {
    // 处理响应数据
    return response.data.data || response.data
  },
  (err) => {
    return Promise.reject(err)
  })

export default axios